<template>
    <div id="index">
      <div>
        <router-view/>
      </div>
      <my-tabbar>
        <my-tabbar-item link="/index/message">
          <img slot="icon" src="../assets/img/tabbar/unmessage.png"/>
          <img slot="icon-active" src="../assets/img/tabbar/message.png"/>
          <div slot="label">消息</div>
        </my-tabbar-item>
        <my-tabbar-item link="/index/contacts">
          <img slot="icon" src="../assets/img/tabbar/uncontacts.png"/>
          <img slot="icon-active" src="../assets/img/tabbar/contacts.png"/>
          <div slot="label">联系人</div>
        </my-tabbar-item>
        <my-tabbar-item link="/index/news">
          <img slot="icon" src="../assets/img/tabbar/unnews.png"/>
          <img slot="icon-active" src="../assets/img/tabbar/news.png"/>
          <div slot="label">看点</div>
        </my-tabbar-item>
        <my-tabbar-item link="/index/wechatMoments">
          <img slot="icon" src="../assets/img/tabbar/unwechatMoments.png"/>
          <img slot="icon-active" src="../assets/img/tabbar/wechatMoments.png"/>
          <div slot="label">动态</div>
        </my-tabbar-item>
      </my-tabbar>
    </div>
</template>

<script>
  import MyTabbar from './common/tabbar/MyTabbar'
  import MyTabbarItem from './common/tabbar/MyTabbarItem'
  export default {
    name: "Index",
    components:{
      MyTabbar,
      MyTabbarItem
    },
    created(){
      //创建websocket连接保存在vuex中
      if(this.$store.getters.getWebSocketReadyState!=1){
        //连接不成功(连接操作)
        this.$store.dispatch('connectWebSocket',{})
        this.$store.dispatch('getHallMessage',{})
      }
    }
  }
</script>

<style scoped>

</style>
